/**
 * Purchase Record Entity Class
 */
package cult.ticketing.bean;

import java.util.Calendar;

import cult.ticketing.bean.Movie;
import cult.ticketing.bean.ScheduleItem;

/**
 * @author 51158282
 *
 */
public class PurchaseRecord {
	
    private int id;
    private int memberId;
    private int scheduleItemId;
    private String seatIndex;
    private int refundStatus; //-1:No refund request; 0:Pending refund; 1:Authenticated refund; 2:Rejected refund
    private String purchaseTime;

    /**
     *
     */
    public PurchaseRecord() {
            // TODO Auto-generated constructor stub
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getMemberId() {
        return memberId;
    }

    public void setMemberId(int memberId) {
        this.memberId = memberId;
    }

    public String getPurchaseTime() {
        return purchaseTime;
    }

    public void setPurchaseTime(String purchaseTime) {
        this.purchaseTime = purchaseTime;
    }

    public int getRefundStatus() {
        return refundStatus;
    }

    public void setRefundStatus(int refundStatus) {
        this.refundStatus = refundStatus;
    }

    public int getScheduleItemId() {
        return scheduleItemId;
    }

    public void setScheduleItemId(int scheduleItemId) {
        this.scheduleItemId = scheduleItemId;
    }

    public String getSeatIndex() {
        return seatIndex;
    }

    public void setSeatIndex(String seatIndex) {
        this.seatIndex = seatIndex;
    }

/*
	public PurchaseRecord(int id, int memberId, int scheduleItemId, int seatId, int refundStatus, Calendar purchaseTime) {
		this.id = id;
		this.memberId = memberId;
		this.scheduleItemId = scheduleItemId;
		this.seatId = seatId;
		this.refundStatus = refundStatus;
		this.purchaseTime = purchaseTime;
	}
	
	public static int getPurchaseRecordCountByUser(int memberId) {
		int count = 0;
		// TODO count = select count id from purchase_record where member_id = memberId
		
		return count;
	}
	
	public static PurchaseRecord[] getPurchaseRecordByUser(int memberId) {
		int recordCount = getPurchaseRecordCountByUser(memberId); // TODO can demise getPurchaseRecordCountByUser and get recordCount from rs.size
		PurchaseRecord[] records = new PurchaseRecord[recordCount];
		
		// TODO rs = select * from purchase_record where member_id = memberId
		
		for (int i=0; i<recordCount; i++) {
			// TODO use constructor to initiate records[i]
			// records[i] = new PurchaseRecord(rs.getInt["id"], etc...)
		}
		
		return records;

	}
	
	public static PurchaseRecord[] getPendingRefund() {
		// TODO rs = select * from purchase_record where status = 0
		int recordCount = 0; // TODO recordCount = size of rs
		
		PurchaseRecord[] records = new PurchaseRecord[recordCount];
		
		for (int i=0; i<recordCount; i++) {
			// TODO use constructor to initiate records[i]
			// records[i] = new PurchaseRecord(rs.getInt["id"], etc...)
		}
		
		return records;
		
	}
	
	public static boolean addPurchaseRecord(int memberId, int scheduleItemId, int seatId, int refundStatus, Calendar purchaseTime) {
		boolean ifAddSuccessful = false;
		// TODO rs = update .... from purchase_record
		
		return ifAddSuccessful;
	}
	
	public int getId() {
		return this.id;
	}
	
	public int getMemberId() {
		return this.memberId;
	}
	
	public int getScheduleItemId() {
		return this.scheduleItemId;
	}
	
	public int getSeatId() {
		return this.seatId;
	}
	
	public int getRefundStatus() {
		return this.refundStatus;
	}
	
	public Calendar getPurchaseTime() {
		return this.purchaseTime;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public void setMemberId(int memberId) {
		this.memberId = memberId;
	}
	
	public void setScheduleItemId(int scheduleItemId) {
		this.scheduleItemId = scheduleItemId;
	}
	
	public void setSeatId(int seatId) {
		this.seatId = seatId;
	}
	
	public void setRefundStatus(int refundStatus) {
		// update refund_status:refundStatus from purchase_record where id = this.id
		
	}

	public void setPurchaseTime(Calendar purchaseTime) {
		this.purchaseTime = purchaseTime;
	}
	
	
*/
	
}
